package org.example;

import com.alibaba.fastjson.JSONObject;

public class CreateErrorReceipt {
    public static String generateReceiptErrorContent(JSONObject validateResult) {
        String errorValue = (String) validateResult.get("error");
        if(errorValue.equals("InvalidBarcode")) {
            String barcodeError = "The barcode cannot be recognized";
            return barcodeError;
        }
        String barcode = (String) validateResult.get("barcode");
        String productNotFound = "The product cannot be found:" + barcode;
        return productNotFound;
    }
}
